fix BaseModel.model_copy() seems to lose intersection data #3113#3547
fix BaseModel.model_copy() seems to lose intersection data #3113#3547asukaminato0721 wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: tornado (https://github.com/tornadoweb/tornado)
+ ERROR tornado/simple_httpclient.py:651:29-49: Argument `HTTPRequest` is not assignable to parameter `self` with type `Self@HTTPRequest` in function `tornado.httpclient.HTTPRequest.headers` [bad-argument-type]
anyio (https://github.com/agronholm/anyio)
+ ERROR src/anyio/_core/_contextmanagers.py:46:25-39: Argument `ContextManagerMixin` is not assignable to parameter `self` with type `Self@object` in function `object.__class__` [bad-argument-type]
+ ERROR src/anyio/_core/_contextmanagers.py:65:20-34: Argument `ContextManagerMixin` is not assignable to parameter `self` with type `Self@object` in function `object.__class__` [bad-argument-type]
+ ERROR src/anyio/_core/_contextmanagers.py:85:25-39: Argument `ContextManagerMixin` is not assignable to parameter `self` with type `Self@object` in function `object.__class__` [bad-argument-type]
+ ERROR src/anyio/_core/_contextmanagers.py:132:25-39: Argument `AsyncContextManagerMixin` is not assignable to parameter `self` with type `Self@object` in function `object.__class__` [bad-argument-type]
+ ERROR src/anyio/_core/_contextmanagers.py:158:20-34: Argument `AsyncContextManagerMixin` is not assignable to parameter `self` with type `Self@object` in function `object.__class__` [bad-argument-type]
+ ERROR src/anyio/_core/_contextmanagers.py:177:25-39: Argument `AsyncContextManagerMixin` is not assignable to parameter `self` with type `Self@object` in function `object.__class__` [bad-argument-type]
dulwich (https://github.com/dulwich/dulwich)
+ ERROR dulwich/refs.py:1704:25-36: Argument `Tag` is not assignable to parameter `self` with type `Self@Tag` in function `dulwich.objects.Tag.object` [bad-argument-type]
bokeh (https://github.com/bokeh/bokeh)
+ ERROR src/bokeh/models/renderers/glyph_renderer.py:213:42-65: Argument `Image` is not assignable to parameter `self` with type `Self@Image` in function `bokeh.models.glyphs.Image.color_mapper` [bad-argument-type]
pandas (https://github.com/pandas-dev/pandas)
+ ERROR pandas/core/groupby/groupby.py:6017:26-34: Argument `Series` is not assignable to parameter `self` with type `Self@Series` in function `pandas.core.series.Series.name` [bad-argument-type]
artigraph (https://github.com/artigraph/artigraph)
- ERROR src/arti/types/pydantic.py:27:16-23: Returned type `Type | _NamedMixin` is not assignable to declared return type `Type` [bad-return]
|
Primer Diff Classification❌ 5 regression(s) | ✅ 1 improvement(s) | 6 project(s) total | +10, -1 errors 5 regression(s) across tornado, anyio, dulwich, bokeh, pandas. error kinds:
Detailed analysis❌ Regression (5)tornado (+1)
anyio (+6)
dulwich (+1)
bokeh (+1)
pandas (+1)
✅ Improvement (1)artigraph (-1)
Suggested fixesSummary: The PR's subst_callable_return_self_type_mut() uses fallback_self_type for parameter Self substitution while the actual self argument is the intersection type, causing bad-argument-type errors on properties and methods accessed through intersection types. 1. In
Was this helpful? React with 👍 or 👎 Classification by primer-classifier (6 LLM) |
Summary
Fixes #3113
Test Plan